Skip to content

fix: rectangular-mesh plot edges follow the mapper node convention#375

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/rect-adapt
Jul 10, 2026
Merged

fix: rectangular-mesh plot edges follow the mapper node convention#375
Jammy2211 merged 1 commit into
mainfrom
feature/rect-adapt

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Closes #372 — the reported "small offsets" in rectangular-mesh source-reconstruction plots. The bilinear interpolation mapper places value (row r, col c) at node U_y=(n_y−r−1)/(n_y−3), U_x=(c−1)/(n_x−3) in unit CDF space (guard ring, row = n − i flip), while edges_transformed drew a uniform [0,1] partition — pcolormesh put flux up to ~1.5 mesh pixels from where the mapper scatters it (delta-function reproduction on the issue). Edges are now the node midpoints through the same CDF machinery (guard-safe max(n−3,1) denominator; border guard cells clamp to the data span). Both consumers inherit the fix: the pcolormesh plot path and rectangular_rotated's warped-centre reconstruction; spline + linear CDFs share the upstream convention.

Plot geometry only — the mapper is untouched; inversions/likelihoods are byte-identical. Only where flux is drawn moves.

API Changes

Changed behaviour: RectangularMeshGeometry.edges_transformed returns mapper-consistent node-midpoint edges (previously a uniform unit-space partition). Consumers that treated it as a uniform grid see shifted (now correct) cell boundaries; the 3×3 degenerate case is value-identical via CDF clamping. Docstring corrected (was a copy-paste about pixel neighbors).

Test Plan

  • pytest test_autoarray/ -q — 877 passed (incl. new delta-centroid regression: pre-fix uniform edges miss by ~0.4 units ≈ 1.5 cells in y; existing test__edges_transformed and rotated-mesh ghost tests unchanged)

Validation checklist (--auto run)

  • Effective level: supervised (bug cap binds over safe header)
  • Plan + confirmed root cause: on the issue (fix: rectangular-mesh pcolormesh plots misaligned with mapper node convention #372), sign-off question answered in-conversation ("go --auto")
  • Gate: tests 877 pass · smoke n/a at this stage (downstream visual check recommended post-merge: regenerate a rectangular-mesh subplot from autolens_workspace_developer's plotting_alignment set) · review CLEAN · Heart YELLOW ⊆ in-session ack
  • Human: merge, amend, or reject — then log the outcome

🤖 Generated with Claude Code

The bilinear interpolation mapper places reconstruction value (row r,
col c) at node U_y=(n_y-r-1)/(n_y-3), U_x=(c-1)/(n_x-3) in unit CDF space
(guard ring at the border, rows flipped by the mapper's row = n - i), but
edges_transformed drew a uniform [0,1] partition — pcolormesh plots put
flux up to ~1.5 mesh pixels from where the mapper scatters it (the "small
offsets" of issue #372, confirmed by a delta-function reproduction). The
edges are now the node midpoints pushed through the same CDF machinery
(guard-safe denominator for degenerate n<=3 meshes; border guard cells
clamp to the data span). Both consumers inherit the fix: the pcolormesh
plot path and rectangular_rotated's warped-centre reconstruction; spline
and linear CDFs share the upstream index convention. Plot geometry only —
the mapper is untouched, so inversions and likelihoods are byte-identical.

#372

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Verification of this fix (visual pipeline + strict node-containment / mapper-faithfulness checks, incl. on the new kernel-CDF meshes of #374) posted on the issue: #372 — confirmed, no residual offsets. Recommend merging this PR first; #374 already contains c177391 and has re-validated on the combined tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: rectangular-mesh pcolormesh plots misaligned with mapper node convention

1 participant